<?php $db = new Mypdo(); ?><?php


if (!empty($_SESSION['login'])&&!empty($_SESSION['email'])){


$immeuManager = new ImmeubleManager($db);
$immeu = $immeuManager->getList();
?>
<h1>Liste des habitations</h1>
<table class="tableau" >
    <tr>
        <th>Nom</th>
        <th>Détail</th>
    </tr>
    <?php foreach ($immeu as $valeur) {  ?>

        <tr>
            <td><?php echo $valeur->getNomImmeu(); ?></td>
            <td><input id="detail" name="detail" type="button" onclick="document.location.href='index.php?page=112&id=<?php echo $valeur->getIdImmeu(); ?>'" /></td>
        </tr>

    <?php } ?>
</table>
    <input id="add" name="add" type="button" onclick="document.location.href='index.php?page=102'" value="Ajouter Habitation" />


<?php }else{
    header('Location: index.php');
}